unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    procedure ShowDateTime(ADate:TDateTime);
  end;

var
  Form1: TForm1;

implementation

uses
  DateUtils;

{$R *.dfm}

procedure TForm1.ShowDateTime(ADate: TDateTime);
begin
  ShowMessage(FormatDateTime('YYYY-MM-DD-HH-MM-SS',ADate));
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowDateTime(Now);
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  ADay:Integer;
  ADate:TDateTime;
begin
  DateSeparator:='-';
  ADate:=StrToDate('2004-02-01');
  ShowDateTime(EndOfTheMonth(ADate));
end;

end.
